// ===============================================
// icon_text
// 
// Create by Will on 2020/10/5 6:05 PM
// Copyright @data_food.All rights reserved.
// ===============================================

import 'package:flutter/material.dart';
import 'package:flutter_base/core/bf_const.dart';

/// 图标+文字的Widget
class IconTextWidget extends StatelessWidget {
  final WidgetBuilder _widgetBuilder;
  final String _text;

  const IconTextWidget(
      this._widgetBuilder,
      this._text, {
        Key key,
      }) : super(key: key);

  @override
  Widget build(BuildContext context) {
    return Container(
      padding: const EdgeInsets.all(16),
      decoration: const BoxDecoration(
        color: CoreKitConst.toastBackgroundColor,
        borderRadius: BorderRadius.all(Radius.circular(8)),
      ),
      child: Column(
        mainAxisSize: MainAxisSize.min,
        children: <Widget>[
          if (_widgetBuilder != null) _widgetBuilder(context),
          if (_text != null)
            Text(
              _text,
              style: const TextStyle(
                color: Colors.white,
                fontSize: 12,
              ),
            ),
        ],
      ),
    );
  }
}
